function [score errmx] = test(net, dat, lab)
	t=cputime;
	
	classNo = size(unique(lab),1);
	errmx=zeros(classNo, classNo+1);
	correct=0;
	for(i=1:size(lab,1))
		answer = tellClass(dat(i,:), net)-1;
		if(answer==lab(i,1))
			++correct;
		end;
		#fill in the error matrix
		#printf("label: %d, answer: %d",lab(i,1),answer);
		errmx(lab(i,1)+1,answer+1)+=1;
	end;
	score=correct/size(lab,1);
	
	printf("Total CPU time: %f seconds \n",cputime-t);
end;
